#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <string.h>
int Judge_string(char* p1, char* p2, int len1, int len2)
{
	int count = 0;
	if (len1 != len2)
	{
		return 0;
	}
	else
	{
		if (strcmp(p1, p2) == 0)
		{
			printf("s1和s1原本就相同\n");
			return 1;
		}
		else
		{
			int k = len1;
			while (k)
			{
				char tmp = *p1;
				int i = 0;
				for (i = 0; i < len1 - 1; i++)
				{
					*(p1 + i) = *(p1 + i + 1);
				}
				*(p1 + i ) = tmp;
				k--;
				count++;
				if (strcmp(p1, p2) == 0)
				{
					printf("s1向左反转%d个字符得到s2\n", count);
					return 1;
				}
			}
			return 0;
		}
	}
}
int main()
{
	char s1[80] = "abcd";
	char s2[80] = "dabc";
	//gets(s1);
	//gets(s2);
	int len1 = strlen(s1);
	int len2 = strlen(s2);
	int ret = Judge_string(s1, s2, len1, len2);
	printf("%d\n", ret);
	return 0;
}